<?php
namespace Admin\Controller;
use Think\Controller;

class AuthController extends Controller {
    public function showlist(){
        header('Content-type:text/html;charset=utf-8');
        $info = D('Auth')->order('auth_path')->select();
        $this->assign('info',$info);
        //dump($info);
        $this->display();
    }
    
    public function tianjia(){
        header('Content-type:text/html;charset=utf-8');
        $auth = new \Model\AuthModel();
        if(!empty($_POST)){
            $z = $auth->saveData($_POST);
            if($z){
                $this->redirect('showlist',array(),2,'添加成功');
            } else {
                $this->redirect('add',array(),2,'添加失败');
            }
        } else {
            $info = D('Auth')->where('auth_level=0')->select();
            $this->assign('info',$info);
            $this->display();
        }
    }
}